home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
NewsTicker.sit
/
NewsTicker
/
source code
/
Internet Code
/
Idler.cp
< prev
next >
Wrap
Text File
|
1997-06-10
|
791b
|
38 lines
/**********************************************************************************
FILE: Idler.cp
Description: A class whose derivative can do things like check for command
period, spin a beach ball, etc.
1996, CE Software, Inc. All rights reserved.
P.O. Box 65580
West Des Moines, Iowa 50265 U.S.A.
***********************************************************************************/
#include "Idler.h"
Idler::Idler (void)
{
mlPeriod = -1;
}
Boolean Idler::PeriodHasExpired (void)
{
return (mlPeriod == -1 || mulNextPeriod <= TickCount ());
}
void Idler::YieldTime (void)
{
if (PeriodHasExpired ())
{
mulNextPeriod = TickCount () + mlPeriod;
YieldAction ();
}
}
void Idler::SetPeriod (long lPeriod)
{
mlPeriod = lPeriod;
mulNextPeriod = TickCount () + lPeriod;
}